package geppetto.phraseHMM.alignmentInformationWriters;

import geppetto.cat.alignments.Alignment;
import geppetto.cat.alignments.AlignmentsSet;
import geppetto.cat.corpus.BilingualCorpus;
import geppetto.phraseHMM.phraseExtraction.extractedphrase.ExtractedPhrasePair;

public class BestAlignmentInformationWriter extends AlignmentInformationWriter{

	protected AlignmentsSet alignmentSet;
	protected BilingualCorpus corpus;
	
	public BestAlignmentInformationWriter(BilingualCorpus corpus,AlignmentsSet alignment) {
		super();
		this.alignmentSet = alignment;
		this.corpus = corpus;
	}

	@Override
	public void writeAlignmentInformation(ExtractedPhrasePair epp) {
		int foreignStartPos = epp.getForeignStartPos();
		int foreignEndPos = epp.getForeignEndPos();
		int sourceStartPos = epp.getSourceStartPos();
		int sourceEndPos = epp.getSourceEndPos();
		String al = alignmentSet.get(epp.getSentenceNumber()).toMosesFormat(corpus, sourceStartPos, sourceEndPos, foreignStartPos, foreignEndPos, -sourceStartPos, -foreignStartPos);
		epp.setAlignmentInformation(al);
	}

	
}
